import { IsOptional, IsString, MinLength, MaxLength, IsEmail } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';

export class UpdateUserDto {
  @ApiProperty({
    description: '用户名',
    example: 'updateduser',
    required: false,
    minLength: 3,
    maxLength: 50
  })
  @IsOptional()
  @IsString()
  @MinLength(3)
  @MaxLength(50)
  username?: string;

  @ApiProperty({
    description: '邮箱地址',
    example: 'updated@example.com',
    required: false,
    format: 'email'
  })
  @IsOptional()
  @IsEmail()
  email?: string;

  @ApiProperty({
    description: '密码',
    example: 'newpassword123',
    required: false,
    minLength: 6,
    maxLength: 100
  })
  @IsOptional()
  @IsString()
  @MinLength(6)
  @MaxLength(100)
  password?: string;

  @ApiProperty({
    description: '昵称',
    example: '更新后的昵称',
    required: false,
    maxLength: 50
  })
  @IsOptional()
  @IsString()
  @MaxLength(50)
  nickname?: string;

  @ApiProperty({
    description: '用户角色',
    example: 'admin',
    required: false,
    maxLength: 20
  })
  @IsOptional()
  @IsString()
  @MaxLength(20)
  role?: string;
}
